
//---------------------------------------------------------------------------
#ifndef PG1_ENTITY2D_H
#define PG1_ENTITY2D_H
//---------------------------------------------------------------------------
#include "pg1_api.h"
//---------------------------------------------------------------------------
#include "math/pg1_math.h"
//---------------------------------------------------------------------------
namespace pg1
{
//---------------------------------------------------------------------------
class Renderer;
//---------------------------------------------------------------------------
class PG1_API Entity2D
{
// constructor
public:
	Entity2D ();
	virtual ~Entity2D ();


// transformation
public:
	void setPos (float fPosX, float fPosY);
	void setRotation (float fRotation);
	void setScale (float fScaleX, float fScaleY);

	float posX () const;
	float posY () const;
	float rotation () const;
	float scaleX () const;
	float scaleY () const;

	float previousPosX () const;
	float previousPosY () const;
	void returnToPos (float fPosX, float fPosY);

protected:
	const Matrix transformationMatrix () const;

private:
	float m_fPosX, m_fPosY;
	float m_fRotation;
	float m_fScaleX, m_fScaleY;
	float m_fPreviousPosX, m_fPreviousPosY;

	Matrix m_pkTransformationMatrix;

	void updateLocalTransformation ();


// collision
public:
	enum CollisionResult
	{
		CollisionVertical,
		CollisionHorizontal,
		NoCollision
	};

	CollisionResult checkCollision (Entity2D& rkEntity2D) const;
	void drawAABB (Renderer& rkRenderer) const;
};
//---------------------------------------------------------------------------
#include "pg1_entity2d.inl"
//---------------------------------------------------------------------------
} // end namespace
//---------------------------------------------------------------------------
#endif // PG1_ENTITY2D_H
//---------------------------------------------------------------------------
